package compiles

import (
	"sync"
)

type ojCompiles struct {
	Luas []string
}
type JudgeRes struct {
	Locks       sync.RWMutex
	MemoryCount int    //内存占用大小
	TimeCount   int    //占用时间 毫秒
	Result      string //执行结果
}

func NewOjCompiiles() ojCompiles {

	o := ojCompiles{}

	o.Luas = initLanguages()

	return o
}

//获取所有支持的语言
func initLanguages() []string {
	Luas := []string{"Java", "Csharp", "C", "Python3"}
	return Luas
}

//Code 要执行的代码
//CodeLanguage 执行的语言
func (oj ojCompiles) Compiles(Code string, CodeLanguage string) JudgeRes {
	impe := NewImple()

	var Res JudgeRes = JudgeRes{}

	switch CodeLanguage {
	case "C":
		Res = impe.GccImple(Code)
	case "Python3":
		Res = impe.PyImple(Code)
	}

	//fmt.Println("执行结果为", Result)

	return Res
}
